package keeto.com.vn.bms.ui.adapter;

import java.util.ArrayList;

import keeto.com.vn.bms.model.report.DetailReportDoctorModel;
import keeto.com.vn.bms.model.report.DetailReportHospitalModel;
import keeto.com.vn.bms.ui.activity.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ReportDetailDoctorAdapter extends BaseAdapter {

	private Context context;
	private LayoutInflater mInflater;
	private ArrayList<DetailReportDoctorModel> mArrayList;

	public ReportDetailDoctorAdapter(Context context,
			ArrayList<DetailReportDoctorModel> ArrayList) {
		this.context = context;
		this.mArrayList = ArrayList;
		this.mInflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mArrayList.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return getItem(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder holder;
		if (convertView == null){
			convertView = mInflater.inflate(R.layout.item_detail_report_layout, null);
			holder = new ViewHolder();
			holder.tvName = (TextView)convertView.findViewById(R.id.tv_detail_name_hos);
			holder.tvSum = (TextView)convertView.findViewById(R.id.tv_detail_sum_hos);
			holder.tvIncome = (TextView)convertView.findViewById(R.id.tv_income_hos);
			convertView.setTag(holder);
		}else{
			holder = (ViewHolder) convertView.getTag();
		}
		holder.tvName.setText(mArrayList.get(position).getDoctorName());
		holder.tvSum.setText("" +mArrayList.get(position).getOperationCount());
		holder.tvIncome.setText("" +mArrayList.get(position).getInComeDoctor());

		return convertView;
	}
	class ViewHolder{
		private TextView tvName;
		private TextView tvSum;
		private TextView tvIncome;
	}

}
